/* DashboardPage.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
}

.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
  width: 250px;
  background: linear-gradient(135deg, #e6f7ff 0%, #b3e5fc 100%);
  color: #0d47a1;
  transition: width 0.3s ease;
  overflow: hidden;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 100;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid rgba(0, 85, 170, 0.1);
}

.system-title {
  font-size: 18px;
  font-weight: 600;
  color: #0d47a1;
}

.collapse-toggle {
  background: none;
  border: none;
  color: #0d47a1;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.collapse-toggle:hover {
  background-color: rgba(0, 136, 255, 0.1);
}

.sidebar-nav {
  padding: 20px 0;
}

.sidebar-nav ul {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 8px;
  margin: 4px 12px;
}

.nav-item:hover {
  background-color: rgba(0, 136, 255, 0.1);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
  box-shadow: 0 4px 12px rgba(100, 181, 246, 0.3);
  color: #ffffff;
}

.nav-icon {
  font-size: 18px;
  margin-right: 12px;
  min-width: 20px;
  text-align: center;
}

.nav-title {
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.nav-title.hidden {
  display: none;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  border-top: 1px solid rgba(0, 85, 170, 0.1);
}

.logout-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px;
  background: rgba(0, 136, 255, 0.1);
  border: none;
  color: #0d47a1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.logout-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  transform: translateX(4px);
}

/* 主内容区域样式 */
.main-content {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.3s;
  position: relative;
}

.notification-btn:hover {
  background-color: #f3f4f6;
}

.notification-btn::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: #f3f4f6;
  border-radius: 8px;
}

.user-avatar {
  font-size: 20px;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
}

.content-wrapper {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background-color: #f5f7fa;
}

/* 仪表盘内容样式 */
.dashboard-content h2 {
  margin-bottom: 24px;
  color: #1f2937;
  font-size: 24px;
  font-weight: 600;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-left: 4px solid #90caf9;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.card h3 {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 500;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 8px;
}

.card-change {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.card-change.positive {
  background-color: #d1fae5;
  color: #059669;
}

.card-change.negative {
  background-color: #fee2e2;
  color: #dc2626;
}

.card-change.neutral {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* 最近活动样式 */
.recent-activities {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.recent-activities h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 16px;
}

.activity-list {
  list-style: none;
}

.activity-list li {
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  color: #4b5563;
  transition: color 0.3s;
}

.activity-list li:hover {
  color: #64b5f6;
}

.activity-list li:last-child {
  border-bottom: none;
}

/* 角色管理样式 */
.role-management {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.role-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.add-role-btn {
  background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(100, 181, 246, 0.3);
}

.add-role-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(100, 181, 246, 0.4);
}

.search-bar {
  display: flex;
  gap: 8px;
}

.search-bar input {
  padding: 10px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  min-width: 250px;
  outline: none;
  transition: border-color 0.3s ease;
}

.search-bar input:focus {
  border-color: #90caf9;
  box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.1);
}

.search-btn {
  background-color: #f3f4f6;
  border: 1px solid #e2e8f0;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background-color: #e5e7eb;
  border-color: #d1d5db;
}

.roles-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.roles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.roles-table th,
.roles-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.roles-table th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #475569;
  position: sticky;
  top: 0;
  z-index: 10;
}

.roles-table tbody tr {
  transition: background-color 0.3s ease;
}

.roles-table tbody tr:hover {
  background-color: #f8fafc;
}

.roles-table td:last-child {
  display: flex;
  gap: 8px;
  align-items: center;
}

.edit-btn,
.delete-btn,
.permissions-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.edit-btn {
  background-color: #f3f4f6;
  color: #4b5563;
}

.edit-btn:hover {
  background-color: #e5e7eb;
}

.delete-btn {
  background-color: #fee2e2;
  color: #dc2626;
}

.delete-btn:hover {
  background-color: #fecaca;
}

.permissions-btn {
  background-color: #dbeafe;
  color: #2563eb;
}

.permissions-btn:hover {
  background-color: #bfdbfe;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.page-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background-color: white;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-btn:hover:not(:disabled) {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

.page-btn.active {
  background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
  color: white;
  border-color: #90caf9;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 其他模块内容样式 */
.module-content {
  background: white;
  padding: 48px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* 权限不足提示样式 */
.module-content h2 {
  color: #e74c3c;
  font-size: 24px;
  margin-bottom: 10px;
}

.module-content p {
  color: #666;
  font-size: 16px;
  line-height: 1.6;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-cards {
  animation: fadeIn 0.5s ease-out;
}

.recent-activities {
  animation: fadeIn 0.7s ease-out;
}

.role-management {
  animation: fadeIn 0.5s ease-out;
}

/* 滚动条样式 */
.content-wrapper::-webkit-scrollbar {
  width: 6px;
}

.content-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.content-wrapper::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.content-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
  }

  .sidebar.collapsed {
    transform: translateX(0);
    width: 70px;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
  }

  .main-header {
    padding: 16px;
  }

  .page-title {
    font-size: 18px;
  }

  .content-wrapper {
    padding: 16px;
  }

  .role-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-bar {
    width: 100%;
  }
  
  .search-bar input {
    flex: 1;
    min-width: 0;
  }
  
  .roles-table {
    font-size: 12px;
  }
  
  .roles-table th,
  .roles-table td {
    padding: 8px 12px;
  }
  
  .roles-table td:last-child {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .edit-btn,
  .delete-btn,
  .permissions-btn {
    padding: 4px 8px;
    font-size: 12px;
  }
}